﻿
using System;
using Betop.Lib.Core.Tree;

namespace Betop.Lib.Core.Dict
{
    public partial class DictInfo:TreeInfo
    {
        public override string GetTableName()
        {
            return "Dict";
        }
        public override string GetInsertSql()
        {
            return "insert into Dict ( [ID], [Name], [Code], [UpperID], [Orders], [Remark]) values ( @ID, @Name, @Code, @UpperID, @Orders, @Remark)";
        }
        public override string GetUpdateSql()
        {
            return "update Dict set  [ID] = @ID, [Name] = @Name, [Code] = @Code, [UpperID] = @UpperID, [Orders] = @Orders, [Remark] = @Remark where ID = @ID";
        }

        public DictInfo() { }
        //public int ID
        //{
        //    get;
        //    set;
        //}
        //public string Name
        //{
        //    get;
        //    set;
        //}
        public int Code
        {
            get;
            set;
        }
        //public int UpperID
        //{
        //    get;
        //    set;
        //}
        //public int Orders
        //{
        //    get;
        //    set;
        //}
        public string Remark
        {
            get;
            set;
        }

        public override void SetValue(string key, object value)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    this.ID = (Int32)value;
                    break;
                case "name":
                    this.Name = (String)value;
                    break;
                case "code":
                    this.Code = (Int32)value;
                    break;
                case "upperid":
                    this.UpperID = (Int32)value;
                    break;
                case "orders":
                    this.Orders = (Int32)value;
                    break;
                case "remark":
                    this.Remark = (String)value;
                    break;
            }
        }
        public override object GetValue(string key)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    return this.ID;
                case "name":
                    return this.Name;
                case "code":
                    return this.Code;
                case "upperid":
                    return this.UpperID;
                case "orders":
                    return this.Orders;
                case "remark":
                    return this.Remark;
                default:
                    return null;
            }
        }


    }
}
